package com.nf.controller.manage;

import com.google.gson.Gson;
import com.nf.controller.BaseServlet;
import com.nf.dao.ShowInfoDao;
import com.nf.dao.impl.ShowInfoDaoImpl;
import com.nf.entity.ShowInfo;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

/**
 * 模糊查询放映计划
 */
@WebServlet("/api/SelectShowsByLikeServlet.do")
public class SelectShowsByLikeServlet extends BaseServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String cond=req.getParameter("cond");

        ShowInfoDao dao =new ShowInfoDaoImpl();
        List<ShowInfo> list= dao.selectByLike(cond);

        resp.setContentType("application/json;charset=utf-8");
        PrintWriter out = resp.getWriter();

        out.print(new Gson().toJson(successJson(list)));
        out.flush();
        out.close();
    }
}
